import unittest
from scripts.test01_login import TestLogin
from scripts.test02_vip import TestVipAPI
import config
import time
# from tools.HTMLTestRunner import HTMLTestRunner
from tools.HTMLTestReportCN import HTMLTestRunner
if __name__ == '__main__':
    # unittest.main()

    suite=unittest.TestSuite()
    suite.addTest(unittest.makeSuite(testCaseClass=TestLogin))
    suite.addTest(unittest.makeSuite(testCaseClass=TestVipAPI))

    report=config.BASE_URL+"/reports/reports-{}.html".format(time.strftime("%Y%m%d-%H%M%H"))

    # with open(report,"wb") as file:
    #     runner=HTMLTestRunner(file)
    #     runner.run(suite)

    with open(report, "wb") as f:
        # 创建HTMLTestRunner的运行器
        runner = HTMLTestRunner(f, title="接口测试报告")

        # 执行测试套件
        runner.run(suite)
